import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import React from 'react';
import { Modal, Button, Spin } from 'antd';
import intl from 'utils/intl';

var TemplateDrawer = /*#__PURE__*/function (_React$Component) {
  _inherits(TemplateDrawer, _React$Component);

  var _super = _createSuper(TemplateDrawer);

  function TemplateDrawer() {
    _classCallCheck(this, TemplateDrawer);

    return _super.apply(this, arguments);
  }

  _createClass(TemplateDrawer, [{
    key: "render",
    value: function render() {
      var _this$props = this.props,
          title = _this$props.title,
          anchor = _this$props.anchor,
          visible = _this$props.visible,
          _this$props$loading = _this$props.loading,
          loading = _this$props$loading === void 0 ? false : _this$props$loading,
          _this$props$onClose = _this$props.onClose,
          onClose = _this$props$onClose === void 0 ? function (e) {
        return e;
      } : _this$props$onClose,
          content = _this$props.content;
      return /*#__PURE__*/React.createElement(Modal, {
        title: title,
        visible: visible,
        destroyOnClose: true,
        width: 700,
        onCancel: onClose,
        wrapClassName: "ant-modal-sidebar-".concat(anchor),
        transitionName: "move-".concat(anchor),
        footer: /*#__PURE__*/React.createElement(Button, {
          onClick: onClose
        }, intl.get('cpaas.common.button.close').d('关闭'))
      }, /*#__PURE__*/React.createElement(Spin, {
        spinning: loading
      }, /*#__PURE__*/React.createElement("div", {
        dangerouslySetInnerHTML: {
          __html: content
        }
      })));
    }
  }]);

  return TemplateDrawer;
}(React.Component);

export { TemplateDrawer as default };